import { reactive } from 'vue';

// 优先从 localStorage 读取用户信息，否则用游客
const userFromStorage = JSON.parse(localStorage.getItem('user'));

export const currentUser = reactive(
  userFromStorage || {
    id: 4, // 默认游客
    nickname: '游客',
    avatar: 'https://example.com/avatars/guest1.jpg'
  }
);